﻿@model IEnumerable<Coticula.Web.Models.Results>

@{
    ViewBag.Title = "Results list";
}

<h2>@ViewBag.Title</h2>

@{
    var webGrid = new WebGrid(Model, canSort: false, canPage: false, rowsPerPage: ViewBag.PageSize);
    int columnsCount = 7;
    WebGridColumn[] columns = new WebGridColumn[columnsCount];
    columns[0] = webGrid.Column("Id", format: @<text>@Html.ActionLink((string)(item.Id.ToString()), "Details", new { id = item.Id })</text>);
    columns[1] = webGrid.Column("User", format: @<text>@item.User.UserName</text>);
    columns[2] = webGrid.Column("Time", format: @<text>@item.Solution.DateTime</text>);
    columns[3] = webGrid.Column("Language", format: @<text>@item.Solution.Language.Name</text>);
    columns[4] = webGrid.Column("Problem", format: @<text>@Html.ActionLink(item.Solution.Problem != null ? (string)item.Solution.Problem.Name : "Error: no problem", "Details", "Problem", new { id = item.Solution.ProblemId }, null)</text>);
    columns[5] = webGrid.Column("Verdict", format: @<text>@item.Verdict.Name</text>);
    columns[6] = webGrid.Column("Score", format: @<text>@item.Score</text>);
    @webGrid.GetHtml(columns: webGrid.Columns(columns))
}

@Html.Partial("~/Views/Shared/_PagedTablePartial.cshtml")